package org.seckill.service;

import org.seckill.dto.Exposer;
import org.seckill.dto.SeckillExecution;
import org.seckill.entity.Seckill;
import org.seckill.exception.RepeatKillException;
import org.seckill.exception.SeckillCloseException;
import org.seckill.exception.SeckillException;

import java.util.List;

/**
 * 业务接口:站在“使用者”角度设计接口
 * 三个方面：方法定义粒度，参数，返回类型(return/异常)
 * Created by acer on 2017/6/12.
 */
public interface SeckillService {

    //查询全部秒杀记录
    List<Seckill> getList();

    //查询单个秒杀记录
    Seckill getById(long seckillId);

    //秒杀开启时返回秒杀接口
    //秒杀未开启时返回系统时间和秒杀时间
    Exposer exportSeckillUrl(long seckillId);

    //执行秒杀操作
    SeckillExecution executeSeckill(long seckillId, long userPhone, String md5)
            throws RepeatKillException,SeckillCloseException,SeckillException;

    SeckillExecution executeSeckillPro(long seckillId, long userPhone, String md5);

}
